﻿using BCT.Models;
using BCT.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BCT.Domains
{
    public class SkillDetailManDomain : ISkillDetailManDomain
    {
        private readonly ISkillDetailManRepository _skillDetailManRepository;
        public SkillDetailManDomain(SkillDetailManRepository skillDetailManRepository)
        {
            _skillDetailManRepository = skillDetailManRepository;
        }
        public DataListModel<SkillDetailModel> GetSkillDetailList(ConditionModel model)
        {
            var skillDetaillist = _skillDetailManRepository.GetSkillDetailList(model.SkillDetailName, model.SkillGroupId);
            var result = new DataListModel<SkillDetailModel>()
            {
                Count = skillDetaillist.Count(),
                Data = skillDetaillist.Skip((model.Page - 1) * model.Limit).Take(model.Limit).ToList()
            };
            return result;
        }
        public bool AddSkillDetail(SkillDetailModel model)
        {
            return _skillDetailManRepository.AddSkillDetail(model);
        }
        public string LogDelete(SkillDetailModel model)
        {
            return _skillDetailManRepository.LogDelete(model);
        }
        public string ModefySkillDetail(SkillDetailModel model)
        {
            return _skillDetailManRepository.ModefySkillDetail(model);
        }
    }
}
